- /* sdfsfast.cpp by K.Tsuru */
- // function ID 3053 DRADIX
- /*********************************************************************************
- SDouble class
- It returs that the SDouble series is faster than the SDecimal one
- or not.
- 1. When x is short and a recurring decimal in the binary radix,the
- D***Series is faster.It may be better to examine that x is also a short value
- in the binary radix(e.g. 0.25), but it will be a rare case.
- 2.For the relatively long number B***Series is faster even if including the
- time costed by the radix conversion.
- 3.When |x| is very small, the number of terms is little and the radix conversion
- costs a much time. Then D***Series is faster.
-
- This is for the trigonometric functions having a general term as x^n/n!.
- For the series whose convergence is late(e.g.AtanSeries) it needs other conditions.
- **********************************************************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
- bool DSeriesIsFast(const SDouble& x){
- uint xfig = x.Last() - x.First()+1u, ef = x.MaxSize();
- int xe = x.RdxExp();
- bool fast = false;
- if(xe <= -10) return true;
- if( (xfig < 32u) || (ef > 1024u) ) return true;
-
- if(xfig < 255u){
- if(xe <= -9) fast = true;
- } else if(xfig < 510u){
- if(xe <= -5) fast = true;
- }
- return fast;
- }
sdfsfast.cpp : last modifiled at 2015/12/03 21:43:53(1,325 bytes)
created at 2017/10/07 10:22:50
The creation time of this html file is 2017/10/07 11:29:39 (Sat Oct 07 11:29:39 2017).